package xyz.yuzegod.megawalls.classes.normal.blaze;

import xyz.yuzegod.megawalls.classes.Classes;
import xyz.yuzegod.megawalls.classes.Skill;
import xyz.yuzegod.megawalls.game.GamePlayer;
import xyz.yuzegod.megawalls.stats.KitStatsContainer;
import xyz.yuzegod.megawalls.util.StringUtils;

import java.util.ArrayList;
import java.util.List;

public class ThirdSkill extends Skill
{
    public ThirdSkill(final Classes classes) {
        super("熔融之心", classes);
    }
    
    @Override
    public int maxedLevel() {
        return 3;
    }
    
    @Override
    public double getAttribute(final int level) {
        switch (level) {
            case 1: {
                return 0.05;
            }
            case 2: {
                return 0.075;
            }
            case 3: {
                return 0.1;
            }
            default: {
                return 0.05;
            }
        }
    }
    
    @Override
    public List<String> getInfo(final int level) {
        final List<String> lore = new ArrayList<String>();
        if (level == 1) {
            lore.add(" §8▪ §7攻击敌人时有§a" + StringUtils.percent(this.getAttribute(level)) + "§7几率将其点燃3秒。");
            lore.add("   §7弓箭命中时几率加倍。");
            lore.add("   §7触发时获得生命恢复。");
            lore.add(" ");
            lore.add("§7冷却时间:§a1秒");
            return lore;
        }
        lore.add(" §8▪ §7攻击敌人时有§8" + StringUtils.percent(this.getAttribute(level - 1)) + " ➜ §a" + StringUtils.percent(this.getAttribute(level)) + "§7几率将其点燃3秒。");
        lore.add("   §7弓箭命中时几率加倍。");
        lore.add("   §7触发时获得生命恢复。");
        return lore;
    }
    
    @Override
    public void upgrade(final GamePlayer gamePlayer) {
        final KitStatsContainer kitStats = gamePlayer.getPlayerStats().getKitStats(this.getClasses());
        kitStats.addSkill3Level();
    }
    
    @Override
    public int getPlayerLevel(final GamePlayer gamePlayer) {
        return gamePlayer.getPlayerStats().getKitStats(this.getClasses()).getSkill3Level();
    }
    
    @Override
    public boolean use(final GamePlayer gamePlayer, final KitStatsContainer kitStats) {
        return true;
    }
    
    @Override
    public String getSkillTip(final GamePlayer gamePlayer) {
        return this.getClasses().getNameColor() + "§l" + this.getName() + " " + ((Blaze.skill3Cooldown.getOrDefault(gamePlayer, 0) == 0) ? "§a§l✓" : ("§c§l" + Blaze.skill3Cooldown.get(gamePlayer) + "秒"));
    }
}
